package com.xhwl.data.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xhwl.common.dto.cent.sdata.RoomDTO;
import com.xhwl.common.dto.cent.sdata.space.RentRoomPicDTO;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.pojo.cent.sdata.Room;
import com.xhwl.common.query.cent.sdata.RoomQuery;
import com.xhwl.data.pojo.space.RoomOperateDTO;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: luyi
 * @Description: 房间
 * @Date: Create in 17:51 2021/1/21
 */
@RestController
public interface IRoomService extends IService<Room> {

    /**
     * 创建
     *
     * @param room
     * @return
     */
    @RequestMapping(value = "/room-service/create", method = RequestMethod.POST)
    ResultJson create(@RequestPart RoomDTO room);

    /**
     * 更新
     *
     * @param room
     * @return
     */
    @RequestMapping(value = "/room-service/update", method = RequestMethod.POST)
    ResultJson update(@RequestPart RoomDTO room);

    /**
     * 删除
     *
     * @param id
     * @param account
     * @return
     */
    @RequestMapping(value = "/room-service/delete", method = RequestMethod.POST)
    ResultJson delete(Integer id, @RequestPart(required = false) Account account);

    /**
     * 分页
     *
     * @param roomQuery
     * @param account
     * @param page
     * @return
     */
    @RequestMapping(value = "/room-service/page", method = RequestMethod.POST)
    Page<Room> page(@RequestPart RoomQuery roomQuery, @RequestPart(required = false) Account account, @RequestPart(required = false) Page page);

    @RequestMapping(value = "/room-service/list", method = RequestMethod.POST)
    List<Room> list(@RequestPart RoomQuery roomQuery);

    /**
     * 单个查询
     *
     * @param roomQuery
     * @return
     */
    @RequestMapping(value = "/room-service/one", method = RequestMethod.POST)
    Room one(@RequestPart RoomQuery roomQuery);

    @RequestMapping(value = "/room-service/detail-by-code", method = RequestMethod.POST)
    Room detailByCode(String code);

    /**
     * 批量创建
     *
     * @param rooms
     * @return
     */
    @RequestMapping(value = "/room-service/batch-insert",method = RequestMethod.POST)
    ResultJson batchCreate(@RequestPart List<RoomDTO> rooms);

	/**
	 * 批量创建
	 * @return
	 */
	ResultJson<List> batchCreateFaster(List<RoomDTO> rooms);

	/**
	 * 租控图分页
	 * @return
	 */
	@RequestMapping(value = "/room-service/rent-room-pic-page", method = RequestMethod.POST)
	Page<RentRoomPicDTO> rentRoomPicPage(@RequestPart RoomQuery roomQuery, @RequestPart Page page);


	ResultJson roomTypeProportionStatistics(Short industryId ,List<Integer> orgIds);


    /**
     * 根据房间功能属性统计数量
     * @param roomQuery
     * @return
     */
	@RequestMapping(value = "/room-service/room-type-count", method = RequestMethod.POST)
	ResultJson getRoomCountByType(@RequestPart RoomQuery roomQuery);

    /**
     * 获取当前编码
     *
     * @return
     */
    String getCurrentCode();

    /**
     * 通过编码集合获取房间信息
     */
    @RequestMapping(value = "/room-service/detail-by-codes", method = RequestMethod.POST)
    List<Room> detailByCodes(@RequestPart List<String> codes);


    /**
     * 拆分
     * @param roomOperateDTO
     * @return
     */
    ResultJson split(RoomOperateDTO roomOperateDTO);

    /**
     * 合并
     * @param roomOperateDTO
     * @return
     */
    ResultJson merge(RoomOperateDTO roomOperateDTO);

    ResultJson refreshSort(RoomQuery roomQuery);
}
